﻿using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Gmantis.Controls.Toolbar
{
    [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
    public class ToolbarCommandConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object command = CommandExtensions.GetCommand((FrameworkElement)value);
            if (command is ToolbarCommand)
            {
                return command;
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
